package com.dtwave.cfstreaming.process.selector;

import com.alibaba.fastjson.JSONObject;
import com.dtwave.utils.JsonUtils;
import org.apache.flink.api.java.functions.KeySelector;

public class KeyByFunction implements KeySelector<JSONObject,String> {
    @Override
    public String getKey(JSONObject jsonObject) throws Exception {
        //keyBy的字段依据具体的实时处理程序区别对待，是否要保证分组唯一
        return JsonUtils.getString(jsonObject, true, "如果是延时器使用需要保证该字段唯一");
    }
}
